<% for scaffold_column in @scaffold_columns %>
  <% column_sort_direction = column_sort_direction(scaffold_column.name, params) %>  
  <% sort_params = params.merge(:controller => @scaffold_controller, :action => 'update_'+@prefix+'table', 
                                :sort => scaffold_column.name, :sort_direction => column_sort_direction, :page => 1) %>
  <% column_header_id = scaffold_column_header_id(sort_params.merge(:column_name => scaffold_column.name)) %>
  <th id="<%= column_header_id %>" <%= "class=\"sorted #{current_sort_direction(params)}\"" if scaffold_column.name == current_sort(params) %>>
  <% if scaffold_column.sortable? %>
    <% href = url_for(sort_params) %> 
    <%= link_to_remote scaffold_column.label, 
      { :url => sort_params,
	    :before => "addAjaxTableUrlToHistory('#{href}')",
        :loading => "Element.addClassName('#{column_header_id}','loading');",
        :update => scaffold_content_id(sort_params) },
      { :href => href } %>
   <% else %>
     <p><%= scaffold_column.label %></p>
   <% end %>
 </th>
<% end %>
<th></th>